﻿using System;
using System.Collections.Generic;
using System.Linq;
using smsg_DAL;

namespace tet
{
    class Program
    {
        static string conUser = "name=SMsgSEntities";
        static string conMessaging = "name=MessagingDB";
        static void Main(string[] args)
        {

            //create admin
            using (smsg_User_List ul = new smsg_User_List(conUser))
            {
                var i = ul.LoadFromDB.LoadFrom_IDUserQ("aaa").Count();
                if (i != 1)
                {
                    smsg_User admin = new smsg_User();
                    admin.IDUser = "AAA";
                    admin.UserEmail = "ignatandrei@yahoo.com";
                    admin.UserName = "admin";
                    ul.Add(admin);
                    ul.SaveNew();
                }
            }
            //DeleteDataUsersSimple();
            //InsertDataUsersSimple();
            //SimpleUser u = new SimpleUser();
            //u.ConnectionUser = conUser;
            //u.ConnectionMessaging = conMessaging;
            //var colFriends=u.FindFriends("x");
            //Console.WriteLine( colFriends.Count());
            //var user = colFriends.First();
            //smsg_Message m = new smsg_Message();
            ////m.UsersFind = new smsg_User_List(conUser);
            ////m.FromUser = u.FindFriends("andrei").First().Key;
            ////m.Subject = "a'";
            ////m.ToUser = user.Key;
            ////u.SendMessage(m);
            

            //DeleteDataUsersSimple();
           
        }
        public static void  InsertDataUsersSimple()
        {
            //using (IUserList<SimpleUser, string> ul = new smsg_User_List(conUser))
            //{
                
            //    ul.Add(new SimpleUser() { Key = Guid.NewGuid().ToString(), UserNameToDisplay= "andrei ignat", OtherInfo= "ignatandrei@yahoo.com" });
            //    ul.Add(new SimpleUser() { Key = Guid.NewGuid().ToString(), UserNameToDisplay = "xxx", OtherInfo = "xxx@yahoo.com" });
                
            //    ul.SaveNew();
                
            //}
        }
        public static void DeleteDataUsersSimple()
        {
            //using (IUserList<SimpleUser, string> ul = new smsg_User_List(conUser))
            //{
            //    ul.FastDeleteAll();
            //}
        }
    }
}
